package com.luo.wheresmytakeaway.utils;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GieUserId {
    public static Integer getUserId(HttpServletRequest request) {
        String authHeader = request.getHeader("Authorization");
        log.info("获取请求头:{}", authHeader);
        String jwt = authHeader.substring(6); // 去掉 Bearer 前缀
        log.info("获取请求头token:{}", jwt);
        Integer id = JwtUtils.getUserId(jwt);
        return id;
    }
}
